Dynamic languages that lack type annotations of any kind are increasingly popular. For example, JavaScript has become the lingua franca of the World Wide Web, while Ruby, Python, Perl, and PHP have become standard languages for server-side infrastructure. However, runtime of dynamic language based code may require significant overhead to execute.
For example, lack of type information may prohibit optimal compilation to avoid dynamic type conversion for a variable. Runtime profiling has been adopted to provide additional type information to improve execution performance. Typical runtime profiling, however, relies on recording types of values encountered and requires complicated data structures and extensive profiling operations. As a result, effectiveness of the compilation is adversely affected for overall performance improvement.
Further, when current runtime values encountered no longer match the previous profiling results, optimally compiled code based on the previous profiling results may cost more processing cycles to execute than a corresponding non-optimally compiled code. Such discrepancies between current runtime values and previous profiling results can severely tax execution performance.
Furthermore, dynamically typed code may be linked with an external library already compiled from non-dynamically typed language based source code. An interface layer is usually created in the dynamically typed code to allow the external library to access data owned by the dynamically typed based code. As a result, runtime performance may be degraded with the overhead incurred by data loading/updating through the interface layer.
Therefore, existing runtime compilation and execution for dynamically typed code tends to introduce performance cost which may be unnecessary, wasteful and avoidable.